<template>
  <nui-custom bgColor="bg-white" :isBack="false">


    <block v-slot:content>
      <text class="text-title">
        我要发布
      </text>
    </block>
    <block v-slot:right>
      <view class="cu-tag round bg-green margin-right-xs" @tap="next">
        下一步
      </view>
    </block>
  </nui-custom>

  <view class="margin-top-xs ">
    <view class="padding-xs">
      <input placeholder="输入标题会更受欢迎"/>

    </view>
    <vusui-editor ref="editor" style="height: 80vh" :toolbar="editor.toolbar" :options="editor.options"
                  v-model:content="editor.content"/>
  </view>


</template>

<script>
export default {
  data() {
    return {
      editor: {
        content: '',
        // quill 配置参数
        options: {},
        toolbar: [

          [{'size': ['small', false, 'large', 'huge']}],  // custom dropdown
          [{'header': [1, 2, 3, 4, 5, 6, false]}],

          [{'color': []}, {'background': []}],          // dropdown with defaults from theme
          [{'font': []}],
          [{'align': []}],
          ["image"]
        ]
      }
    }
  },
  methods: {
    getHtml() {
      let html = this.$refs.editor.getHTML();
      console.log(html)

      return html
    },
    next() {
      let html = this.getHtml()
      uni.setStorageSync("html", html);
      uni.navigateTo({
        url: "/pages/publish/preview"
      })
    }

  }
}
</script>

<style scoped>

</style>